Skip to content

[kotlin-server][jaxrs-spec] treat parameters with a default value as non-null#14413

Merged
wing328 merged 1 commit into
OpenAPITools:masterfrom
exaV:master
Aug 6, 2023
Merged

[kotlin-server][jaxrs-spec] treat parameters with a default value as non-null#14413
wing328 merged 1 commit into
OpenAPITools:masterfrom
exaV:master

Conversation

@exaV

@exaV exaV commented Jan 10, 2023

Copy link
Copy Markdown
Contributor

Without this change parameters with a default value as described here https://swagger.io/docs/specification/describing-parameters/ would be treated as nullable. With this change they are now correctly marked as non-null.

PR checklist

  • Read the contribution guidelines.
  • Pull Request title clearly describes the work in the pull request and Pull Request description provides details about how to validate the work. Missing information here may result in delayed response from the community.
  • Run the following to build the project and update samples:
    ./mvnw clean package 
    ./bin/generate-samples.sh
    ./bin/utils/export_docs_generators.sh
    
    Commit all changed files.
    This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master.
    These must match the expectations made by your contribution.
    You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example ./bin/generate-samples.sh bin/configs/java*.
    For Windows users, please run the script in Git BASH.
  • File the PR against the correct branch: master (6.3.0) (minor release - breaking changes with fallbacks), 7.0.x (breaking changes without fallbacks)
  • If your PR is targeting a particular programming language, @mention the technical committee members, so they are more likely to review the pull request.

@exaV exaV changed the title [kotlin-server] treat parameters with a default value as non-null [kotlin-server][jaxrs-spec] treat parameters with a default value as non-null Jan 10, 2023
@exaV

exaV commented Jan 10, 2023

Copy link
Copy Markdown
Contributor Author

@jimschubert @dr4ke616 @karismann @Zomzog @andrewemery @4brunu @yutaka0m I'm pinging you because you're listed as kotlin maintainers.

@exaV

exaV commented Feb 1, 2023

Copy link
Copy Markdown
Contributor Author

@jimschubert could you please have a look at this MR? It is a small change and non-breaking.

@exaV

exaV commented Feb 9, 2023

Copy link
Copy Markdown
Contributor Author

rebased onto openapitools/master

@exaV

exaV commented Feb 10, 2023

Copy link
Copy Markdown
Contributor Author

@wing328 hi I got no response from Kotlin maintainers for a month. Could you help getting this merged?

The change is really quite simple:
I changed the condition for a nullable type from
{{^required}}?{{/required}} to {{^defaultValue}}{{^required}}?{{/required}}{{/defaultValue}} meaning neither defaultvalue nor required must exist on a property for it to get a nullable type. This is a backwards compatible change because non-null types are assignable to their nullable counterparts.

@wing328

wing328 commented Aug 6, 2023

Copy link
Copy Markdown
Member

I think we need to consider nullable: true as well. I'll file another PR to fix that and add a test.

@wing328 wing328 merged commit 350ec2a into OpenAPITools:master Aug 6, 2023
@wing328

wing328 commented Aug 6, 2023

Copy link
Copy Markdown
Member

@exaV sorry for the delay in merging this PR as there are too many PRs pending review.

@wing328

wing328 commented Aug 6, 2023

Copy link
Copy Markdown
Member

FYI. I've filed #16265 to fix the default value (e.g. ""available"" instead of "avaialble"), add nullable support, and add tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants